#!/bin/bash
LOGFILE="/tmp/quotalog"
WAIT_CLIENT_SYNC=5;  # 等待 client 同步配额信息

function clean_quota() {
    echo -n -e "=====清理已存在配额===== ";
    eval sh ${QUOTA_CLEAN_FILE} 1 &> /dev/null
    quota_num=`orcafs-ctl --listquota | grep DIR | wc -l`
    if ((${quota_num} == 0));then echo "pass"; else echo "not pass"; exit 1; fi;
}

function func_get_quota_used() {
    used=`orcafs-ctl --listquota | grep -E -w "${WRITEQUOTA}" | grep -w DIR | awk '{print $8}'`
    #echo -n -e "quota used (${used}):\n  [ls ${WRITEDIR}]: "; ls -l ${WRITEDIR}
    echo -e "quota used (${used})"
    global_used=$used
}

function func_cleandir() {
    dir_path=`realpath $1`
    if [ "${dir_path}" == "/" ]; then
        echo "clean Dir: ${dir_path} is root"
    else
        rm -rf ${dir_path}/*
    fi
}

function func_rmdir() {
    dir_path=`realpath $1`
    if [ "${dir_path}" == "/" ]; then
        echo "Rm Dir: ${dir_path} is root dir"
    else
        rm -rf ${dir_path}
    fi
}

echo "=====加载配额测试功能函数===== pass"
